<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //声明一个数组
        const xiyou = ['唐僧', '孙悟空', '猪八戒', '沙僧']

        //使用for...of遍历数组
        //xiyou是这个数组，v是每个数组中的元素
        //for in循环里面保存的是键名即0，1,2,3，for of是键值
        for (let v of xiyou) {
            console.log(v);
            console.log('aaaa');
        }

        let iterator = xiyou[Symbol.iterator]();

        //调用对象的next值
        console.log(iterator.next());
        console.log(iterator.next());
        console.log(iterator.next());
        console.log(iterator.next());
        console.log(iterator.next());

    </script>
</body>

</html>